<script type="text/javascript">
function codeAddress() {
	var address = document.getElementById("q").value;
    var geocoder = new google.maps.Geocoder();    
    var urlDefault = '<?php echo $vars['url']?>';
    geocoder.geocode({'address': address}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            var latlng = results[0].geometry.location;
            var url =  urlDefault + 'pg/locations/search' + '?lat='+ latlng.lat() + '&long='+ latlng.lng()
            window.location.href =  url;
        } else {
           // alert("Geocode was not successful for the following reason: " + status);
        }
    });
}
</script>
